﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using COM.OA.BLL;
using COM.OA.Entity;
using System.Collections.Generic;

public partial class updatezuming : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
               
        //取群名
        string yuanname = this.Request.Form["hidname"];
        //群新群名
        string newname = this.Request.Form["groupnames"];
        if (newname == null || newname == "")
        {
            this.Response.Write(string.Format(GetRedirect.WINALERT,"新群名不能为空"));
            
            return;
        }
        //格式化
        String where = "g_groupname='{0}'";
        where = string.Format(where, yuanname);
        //查询获取原实体
        IList<groups> glist=groupsBLL.Select(where);
        
        //存进实体
        if (glist.Count != 0)
        {
            groups g = glist[0];
            //设置新群名
            g.g_groupname = newname;
            //更新群名
            groupsBLL.Update(g);
            this.Response.Write(string.Format(GetRedirect.WINALERT, "保存成功"));
            this.Response.Write(string.Format(GetRedirect.REDIRECT, "qunzu.aspx"));
        }
        else
        {
            this.Response.Write(string.Format(GetRedirect.REDIRECT, "qunzu.aspx"));
        }
    }
}
